#include <future>
#include <iostream>

int main() {
    auto fibonacci = [](int n) {
        int a = 0, b = 1;
        for (int i = 0; i < n; ++i) {
            int temp = a;
            a = b;
            b = temp + b;
        }
        return a;
    };

    std::future<int> result = std::async(std::launch::async, fibonacci, 10);
    int value = result.get(); // 获取异步任务的结果
    std::cout << "Fibonacci(10) = " << value << std::endl;
    return 0;
}